package com.fjec.paid.controller;

import com.fjec.paid.schedule.handler.RefundHandler;
import com.fjec.paid.service.IBizOrderRefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/")
public class DevopsController {
    @Resource
    private IBizOrderRefundService bizOrderRefundService;

    @Autowired
    private RefundHandler refundHandler;

    @PostMapping("/order/complaint/refund")
    public Integer saveRefund(Long id, Long orderId, Long subOrderId, String amount) {
        int result = bizOrderRefundService.saveRefund(id, orderId, subOrderId, amount);
        return result;
    }

    @PostMapping("/order/complaint/refund/test")
    public String testRefund() {
        refundHandler.handle(10, 0);
        return "success";
    }
}
